package com.voicecall.voicecall.domain;

import java.util.Map;

/**
 * Created by Steven on 2015/4/13.
 */
public class TaskResponse {
    public static final String WAITING="0";  //工作站处于等待状态
    public static final String FINISHED="1";  //工作站处理完成
    public static final String ERROR="2";  //工作站未能处理业务

    private String rmiHost; //rmi服务地址+port。ITF产生，客户端可以由此调用具体某台RMI服务器。可以为空。

    private String status;  //业务处理状态。ITF或WorkStation产生，不可以为空
    private String message;  //返回的信息。ITF或WorkStation产生，可以为空

    private String taskID;  //任务调度ID。WorkStation从TaskRequest复制，不可以为空
    private String bizId;   //业务ID。WorkStation从TaskRequest复制，不可以为空
    private String dbName;  //数据源名称。WorkStation从TaskRequest复制，不可以为空

    private Map<String,Object> result; //工作站处理的结果，可以为空。暂定key为0，1，2....

    private String callBackURL;  //特定的返回地址，可以为空，为空则表示无返回。WorkStation从TaskRequest复制
    private String callBackServiceName;  //返回结果接受方用来处理结果数据的类，可以为空。WorkStation从TaskRequest复制
    private String callBackMethodName;  //返回结果接受方用来处理结果数据的类的方法，可以为空。WorkStation从TaskRequest复制

    private boolean reSendSign;  //重发标记。根据具体业务做出处理

    public boolean isReSendSign() {
        return reSendSign;
    }

    public void setReSendSign(boolean reSendSign) {
        this.reSendSign = reSendSign;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getDbName() {
        return dbName;
    }

    public void setDbName(String dbName) {
        this.dbName = dbName;
    }

    public String getCallBackURL() {
        return callBackURL;
    }

    public void setCallBackURL(String callBackURL) {
        this.callBackURL = callBackURL;
    }

    public String getCallBackServiceName() {

        return callBackServiceName;
    }

    public void setCallBackServiceName(String callBackServiceName) {
        this.callBackServiceName = callBackServiceName;
    }

    public String getCallBackMethodName() {
        return callBackMethodName;
    }

    public void setCallBackMethodName(String callBackMethodName) {
        this.callBackMethodName = callBackMethodName;
    }

    public String getBizId() {
        return bizId;
    }

    public void setBizId(String bizId) {
        this.bizId = bizId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public void setResult(Map<String, Object> result) {
        this.result = result;
    }



    public String getTaskID() {
        return taskID;
    }

    public void setTaskID(String taskID) {
        this.taskID = taskID;
    }


    public Map<String, Object> getResult() {
        return result;
    }

    public String getRmiHost() {
        return rmiHost;
    }

    public void setRmiHost(String rmiHost) {
        this.rmiHost = rmiHost;
    }

    /**
     * 从TaskRequest复制必要的属性
     * @param taskRequest
     */
    public void cloneFromTaskRequest(TaskRequest taskRequest){
        setBizId(taskRequest.getBizId());
        setTaskID(taskRequest.getTaskId());

        setCallBackMethodName(taskRequest.getCallBackMethodName());
        setCallBackServiceName(taskRequest.getCallBackServiceName());
        setCallBackURL(taskRequest.getCallBackURL());

        setDbName(taskRequest.getDbName());

    }
}
